<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>短连接配置</title>
  <link rel="stylesheet" href="/fission/css/layui.css">
  <link rel="stylesheet" href="/fission/css/common.css">
  <style>
    /*dao hang*/
    /*dao hang*/
     .public-header-nav{
      background: #fff;
      border-bottom: 1px solid #e6e6e6;
      display: flex;
      align-items: center;
      margin: 16px 16px 0 16px;
      border-radius: 4px 4px 0px 0px;
    }
    .public-header-nav li{
      
    }
    .public-header-nav li a{
      color: #333;
      font-size: 14px;
      line-height: 47px;
      padding: 0 20px;
      display: block;
    }
    .public-header-nav-active{
      color: #1E9FFF !important;
      border-bottom: 2px solid #1E9FFF !important;
    }
  </style>
</head>
<body>
  <div style="margin-top: 0;" class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="public-header-nav">
      <li><a href="mission_list.html">任务列表</a></li>
      <li><a href="mission_statistics.html">数据分析</a></li>
      <li><a href="mission_xianzhi.html">区域限制配置</a></li>
      <li><a href="stage_prize.html">裂变兑换码</a></li>
      <li><a class="public-header-nav-active" href="short_url.html">短链接配置</a></li>
    </ul>
    <div class="layui-form" style="padding: 20px 20px 20px 20px;background: #fff;margin: 16px;">
           <div class="layui-form-item">
              <label class="layui-form-label" ><span style="color:red;">*</span>短链接状态:</label>
              <div class="layui-input-inline">
                  <input type="checkbox" id="suowo_switch" name="suowo_switch" lay-filter="test" lay-skin="switch" lay-text="开启|关闭" 
                  value="{$config->suowo_switch?1:0}" {if $config->suowo_switch == 1}checked{/if}>
              </div>
           </div>

          <div class="layui-form-item">
              <label class="layui-form-label" ><span style="color:red;">*</span>key:</label>
              <div class="layui-input-inline">
                  <input type="text" id="suowo_key" required lay-verify="required" placeholder="请输入您的key" autocomplete="off" class="layui-input" 
                  value="{$config->suowo_key}">
              </div>
              <div class="layui-form-mid layui-word-aux">(获取地址：<a target="_blank" href="https://suowo.cn/">https://suowo.cn</a>)</div>
          </div>
          <div class="layui-form-item" style="margin-bottom: 0;">
              <div class="layui-input-block">
                  <button class="layui-btn layui-btn-normal" id="update_confing">修改配置</button>
              </div>
          </div>
   
    </div>

  </div>
  <script src="/fission/js/layui.all.js"></script>
  <script src="/js/ajax.js"></script>
  <script>
    $("#update_confing ").click(function () {
        var suowo_key = $("#suowo_key").val();
        var suowo_switch = $("#suowo_switch").val();
        myAjaxPost(false, true, 'short_url.html', { suowo_key:suowo_key,suowo_switch:suowo_switch}, function (resp) {
            tusi(resp.msg);
        })
    })
	
  layui.use('form', function(){
    var form = layui.form;
    //各种基于事件的操作，下面会有进一步介绍
    form.on('switch(test)', function(data){
      if(data.elem.checked){
        $("#suowo_switch").val(1)
      }else{
        $("#suowo_switch").val(0)
      }
    });  
  });
  </script>
</body>
</html>